public class Demo1 {
        public boolean checkWon(int[][] board) {
            for (int i = 0; i < board.length - 2; i++) {
                for (int j = 0; j < board[i].length - 2; j++) {
                    if (board[i][j] == board[i][j + 1] && board[i][j + 1] == board[i][j + 2] && board[i][j] != 0) {
                        return true;
                    }

                    if (board[i][j] == board[i + 1][j] && board[i + 1][j] == board[i + 2][j] && board[i + 1][j] != 0) {
                        return true;
                    }

                    if (board[i][j] == board[i + 1][j + 1] && board[i + 1][j + 1] == board[i + 2][j + 2] && board[i][j] != 0 && board[i][j] != -1) {
                        return true;
                    }

                }
            }
            return false;
        }
}
